package com.test.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.aop.Before;
import com.jfinal.aop.Clear;
import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.jfinal.plugin.activerecord.Page;
import com.test.interceptor.DemoInterceptor;
import com.test.service.UserService;

@Path("/hello")

public class HelloController extends Controller {
    public void index() {
        renderText("Hello JFinal World.");
    }

    public void login() {
        int age = getParaToInt("age");

        renderText("参数" + age);
    }

    public void test() {
        String json = getRawData();
        JSONObject jsonObject = JSON.parseObject(json);

        renderText("ok" + jsonObject.getString("username"));
    }

    @Inject
    UserService zx ;
    @Clear
    public void test2(String username,String passWord){

        zx.getUser2();
        System.out.printf("------>");
        renderText(username);
    }
}